From 21c11b8f40ff7936272b875cb0b282eec035d130 Mon Sep 17 00:00:00 2001 From: Shinjiman Date: Wed, 20 May 2009 07:14:03 +0000 Subject: [PATCH] * (bug 5755) Introduce {{CURRENTMONTH1}} and {{LOCALMONTH1}} to display the month number without the leading zero * added {{CURRENTMONTH2}} and {{LOCALMONTH2}} as alias of {{CURRENTMONTH}} and {{LOCALMONTH}} for consistency with other magic words --- RELEASE-NOTES | 2 ++ includes/MagicWord.php | 4 ++++ includes/parser/Parser.php | 5 +++++ languages/messages/MessagesEn.php | 6 ++++-- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 255cf5305f..fd102bf9e7 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -63,6 +63,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Database: unionQueries function to be used for UNION sql construction, so it can be overloaded on DB abstraction level for DB specific functionality * (bug 18849) Implement Japanese and North Korean calendars +* (bug 5755) Introduce {{CURRENTMONTH1}} and {{LOCALMONTH1}} to display the + month number without the leading zero === Bug fixes in 1.16 === diff --git a/includes/MagicWord.php b/includes/MagicWord.php index 8fdfddc9eb..b69d57e8be 100644 --- a/includes/MagicWord.php +++ b/includes/MagicWord.php @@ -36,6 +36,7 @@ class MagicWord { static public $mVariableIDsInitialised = false; static public $mVariableIDs = array( 'currentmonth', + 'currentmonth1', 'currentmonthname', 'currentmonthnamegen', 'currentmonthabbrev', @@ -46,6 +47,7 @@ class MagicWord { 'currenttime', 'currenthour', 'localmonth', + 'localmonth1', 'localmonthname', 'localmonthnamegen', 'localmonthabbrev', @@ -106,6 +108,7 @@ class MagicWord { /* Array of caching hints for ParserCache */ static public $mCacheTTLs = array ( 'currentmonth' => 86400, + 'currentmonth1' => 86400, 'currentmonthname' => 86400, 'currentmonthnamegen' => 86400, 'currentmonthabbrev' => 86400, @@ -116,6 +119,7 @@ class MagicWord { 'currenttime' => 3600, 'currenthour' => 3600, 'localmonth' => 86400, + 'localmonth1' => 86400, 'localmonthname' => 86400, 'localmonthnamegen' => 86400, 'localmonthabbrev' => 86400, diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 782d00159c..f17cf0ad02 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -2341,6 +2341,7 @@ class Parser wfSuppressWarnings(); // E_STRICT system time bitching $localTimestamp = date( 'YmdHis', $ts ); $localMonth = date( 'm', $ts ); + $localMonth1 = date( 'n', $ts ); $localMonthName = date( 'n', $ts ); $localDay = date( 'j', $ts ); $localDay2 = date( 'd', $ts ); @@ -2356,6 +2357,8 @@ class Parser switch ( $index ) { case 'currentmonth': return $this->mVarCache[$index] = $wgContLang->formatNum( gmdate( 'm', $ts ) ); + case 'currentmonth1': + return $this->mVarCache[$index] = $wgContLang->formatNum( gmdate( 'n', $ts ) ); case 'currentmonthname': return $this->mVarCache[$index] = $wgContLang->getMonthName( gmdate( 'n', $ts ) ); case 'currentmonthnamegen': @@ -2368,6 +2371,8 @@ class Parser return $this->mVarCache[$index] = $wgContLang->formatNum( gmdate( 'd', $ts ) ); case 'localmonth': return $this->mVarCache[$index] = $wgContLang->formatNum( $localMonth ); + case 'localmonth1': + return $this->mVarCache[$index] = $wgContLang->formatNum( $localMonth1 ); case 'localmonthname': return $this->mVarCache[$index] = $wgContLang->getMonthName( $localMonthName ); case 'localmonthnamegen': diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 1bfa97048d..32913cf8c1 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -210,7 +210,8 @@ $magicWords = array( 'toc' => array( 0, '__TOC__' ), 'noeditsection' => array( 0, '__NOEDITSECTION__' ), 'noheader' => array( 0, '__NOHEADER__' ), - 'currentmonth' => array( 1, 'CURRENTMONTH' ), + 'currentmonth' => array( 1, 'CURRENTMONTH', 'CURRENTMONTH2' ), + 'currentmonth1' => array( 1, 'CURRENTMONTH1' ), 'currentmonthname' => array( 1, 'CURRENTMONTHNAME' ), 'currentmonthnamegen' => array( 1, 'CURRENTMONTHNAMEGEN' ), 'currentmonthabbrev' => array( 1, 'CURRENTMONTHABBREV' ), @@ -220,7 +221,8 @@ $magicWords = array( 'currentyear' => array( 1, 'CURRENTYEAR' ), 'currenttime' => array( 1, 'CURRENTTIME' ), 'currenthour' => array( 1, 'CURRENTHOUR' ), - 'localmonth' => array( 1, 'LOCALMONTH' ), + 'localmonth' => array( 1, 'LOCALMONTH', 'LOCALMONTH2' ), + 'localmonth1' => array( 1, 'LOCALMONTH1' ), 'localmonthname' => array( 1, 'LOCALMONTHNAME' ), 'localmonthnamegen' => array( 1, 'LOCALMONTHNAMEGEN' ), 'localmonthabbrev' => array( 1, 'LOCALMONTHABBREV' ), -- 2.20.1